# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl WWW-BBB-API.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use strict;
use warnings; 

use Test::More;

plan tests => 8;

use_ok('WWW::BBB::API::Response');

my $res = new WWW::BBB::API::Response();
ok($res->isa('WWW::BBB::API::Response'), "ISA Object checking");

my $xml_success = <<"";
<response>
<returncode>SUCCESS</returncode>
<meetingID>meetingID</meetingID>
<attendeePW>attendeePW</attendeePW>
<moderatorPW>moderatorPW</moderatorPW>
<hasBeenForciblyEnded>false</hasBeenForciblyEnded>
<messageKey/>
<message/>
</response>

$res->xml($xml_success);

ok($res->result eq 'SUCCESS', "Check result in SUCCESS mode");
ok($res->messageKey eq '', "Check messageKey in SUCCESS mode");
ok($res->message eq '', "Check message in SUCCESS mode");



my $xml_failed =<<"";
<response>
<returncode>FAILED</returncode>
<messageKey>checksumError</messageKey>
<message>You did not pass the checksum security check</message>
</response>

$res->xml($xml_failed);

ok($res->result eq 'FAILED', "Check result in FAILED mode");
ok($res->messageKey eq 'checksumError', "Check messageKey in FAILED mode");
ok($res->message eq 'You did not pass the checksum security check', "Check message in FAILED mode");

